package Expe4;

import java.util.Scanner;

/**
 * @Author sy
 * @Date 2022/9/13
 */
public class Expe4T7 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入4位会员卡号：");
        int memNum = sc.nextInt();
        System.out.println("会员卡号是：" + memNum);

        int ge = memNum % 10;
        int shi = memNum / 10 % 10;
        int bai = memNum / 100 % 10;
        int qian = memNum / 1000;
        System.out.println("千位数：" + qian + "，百位数：" + bai + "，十位数：" + shi + "，个位数：" + ge);

        int sum = ge + shi + bai + qian;
        System.out.println("会员卡号" + memNum + "各位之和：" + sum);
        if (sum > 20) {
            System.out.println("会员卡号" + memNum + "的会员，您中奖了！奖品是MP3！");
        } else {
            System.out.println("会员卡号" + memNum + "的会员，您没有中奖");
        }
    }
}
